GdkAppLaunchContext: Use the display name for X11
authorOlivier Fourdan <ofourdan@redhat.com>
Mon, 12 Oct 2015 14:11:11 +0000 (16:11 +0200)
committerOlivier Fourdan <ofourdan@redhat.com>
Tue, 13 Oct 2015 06:39:05 +0000 (08:39 +0200)
Using a NULL GAppInfo with g_app_launch_context_get_display() will
generate a critical warning in gio.

Use the display name instead as we don't have any valid GAppInfo to pass
to g_app_launch_context_get_display().

bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=756439

gdk/x11/gdkapplaunchcontext-x11.c

index e82f57805750e550989dc6684dc6e14bd8d56d7c..bb38e62c59ee8ea9e7a2ab3c6dcbd81fcb524029 100644 (file)
@@ -463,14 +463,13 @@ GdkAppLaunchContext *
 _gdk_x11_display_get_app_launch_context (GdkDisplay *display)
 {
   GdkAppLaunchContext *ctx;
-  static gchar *display_name;
+  const gchar *display_name;
 
   ctx = g_object_new (GDK_TYPE_X11_APP_LAUNCH_CONTEXT,
                       "display", display,
                       NULL);
 
-  display_name = g_app_launch_context_get_display (G_APP_LAUNCH_CONTEXT (ctx),
-                                                   NULL, NULL);
+  display_name = gdk_display_get_name (display);
   if (display_name)
     g_app_launch_context_setenv (G_APP_LAUNCH_CONTEXT (ctx),
                                  "DISPLAY", display_name);